package com.mynature.booking.manager;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;

import com.mynature.booking.database.DatabaseManager;
import com.mynature.booking.model.Login;
import javax.swing.JButton;

public class QueryInfo extends JFrame {

	private static final long serialVersionUID = 6565006525650943696L;


	private JPanel contentPane;


	public static QueryInfo frame = new QueryInfo();					
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	

	/**
	 * Create the frame.
	 */
	public QueryInfo() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblName = new JLabel("Name");
		lblName.setBounds(10, 23, 54, 15);
		contentPane.add(lblName);
		
		JLabel lblSex = new JLabel("Sex");
		lblSex.setBounds(10, 62, 54, 15);
		contentPane.add(lblSex);
		
		JLabel lblAge = new JLabel("Age");
		lblAge.setBounds(10, 100, 54, 15);
		contentPane.add(lblAge);
		
		JLabel lblPhone = new JLabel("Phone");
		lblPhone.setBounds(10, 143, 54, 15);
		contentPane.add(lblPhone);
		
		JLabel lblPn = new JLabel("PersonalNumber");
		lblPn.setBounds(10, 181, 93, 15);
		contentPane.add(lblPn);
		
		textField = new JTextField();
		textField.setBounds(100, 20, 93, 21);
		contentPane.add(textField);
		textField.setColumns(10);
		textField.setText(DatabaseManager.getInstance().queryPersonByPersonalNumber(Login.i).getName());
		textField.setEditable(false);
		
		textField_1 = new JTextField();
		textField_1.setBounds(100, 59, 93, 21);
		contentPane.add(textField_1);
		textField_1.setColumns(10);
		textField_1.setText(DatabaseManager.getInstance().queryPersonByPersonalNumber(Login.i).getSex());
		textField_1.setEditable(false);
		
		textField_2 = new JTextField();
		textField_2.setBounds(100, 97, 93, 21);
		contentPane.add(textField_2);
		textField_2.setColumns(10);
		textField_2.setText(DatabaseManager.getInstance().queryPersonByPersonalNumber(Login.i).getAge()+"");
		textField_2.setEditable(false);
		
		textField_3 = new JTextField();
		textField_3.setBounds(100, 140, 93, 21);
		contentPane.add(textField_3);
		textField_3.setColumns(10);
		textField_3.setText(DatabaseManager.getInstance().queryPersonByPersonalNumber(Login.i).getPhone()+"");
		textField_3.setEditable(false);
		
		textField_4 = new JTextField();
		textField_4.setBounds(100, 178, 93, 21);
		contentPane.add(textField_4);
		textField_4.setColumns(10);
		textField_4.setText(DatabaseManager.getInstance().queryPersonByPersonalNumber(Login.i).getIdcard()+"");
		textField_4.setEditable(false);
		
		JButton btnConfirm = new JButton("Confirm");
		btnConfirm.setBounds(248, 58, 93, 23);
		contentPane.add(btnConfirm);
		
		JButton btnCancel = new JButton("Back");
		btnCancel.setBounds(248, 115, 93, 23);
		contentPane.add(btnCancel);
		btnCancel.addActionListener(new ActionListener() {

				public void actionPerformed(ActionEvent arg0) {
					setVisible(false);
					Login.frame.setVisible(true);
				}
			});

		
	}
}
